<script setup lang="ts">
const format = (cmd: "bold" | "italic" | "underline") => {
  document.execCommand(cmd);
};
// const bold = () => {
//   document.execCommand("bold");
// };
</script>

<template>
  <!-- <input /> -->
  <!-- <textarea></textarea> -->
  <button @click="format('bold')">加粗</button>
  <button @click="format('italic')">斜体</button>
  <button @click="format('underline')">下划线</button>
  <div class="editor-container" contenteditable="true"></div>
</template>

<style scoped>
.editor-container {
  width: 100%;
  border: 1px solid #ccc;
  min-height: 200px;
  padding: 10px;
}
</style>
